package cn.com.gaobb.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @package: cn.yungtay.shelf.enums
 * @description:
 * @author: hpt
 * @date: 2020/08/10
 **/
public enum ProServerEnums {
    /**
     * 存在类型
     */
    DELENOT("存在", ProServerConsts.ENUM_DELETE_TYPE,1),
    DELEYES("已删除", ProServerConsts.ENUM_DELETE_TYPE,2),

    /**
     * 状态类型
     */
    STASHZ("审核中", ProServerConsts.ENUM_STATUS_TYPE,1),
    STASHTG("审核通过", ProServerConsts.ENUM_STATUS_TYPE,2),
    STASB("审核失败", ProServerConsts.ENUM_STATUS_TYPE,3),

    /**
     * 角色类型
     */
    RELOYD("1管理员", ProServerConsts.ENUM_ROLE_TYPE,1),
    RELOWYCJ("物业超级管理员", ProServerConsts.ENUM_ROLE_TYPE,2),
    ROLEPT("物业普通管理员", ProServerConsts.ENUM_ROLE_TYPE,3),

    /**
     * 启停用类型
     */
    USEDQY("启用", ProServerConsts.ENUM_USED_TYPE,1),
    USEDTY("停用", ProServerConsts.ENUM_USED_TYPE,2),

    /**
     * 启停用类型
     */
    DEFAMR("默认", ProServerConsts.ENUM_DEFAULT_TYPE,1),
    DEFANMR("不是默认", ProServerConsts.ENUM_DEFAULT_TYPE,2),

    ;
    private Integer type;
    private Integer value;
    private String name;

    ProServerEnums(String name, Integer type, Integer value) {
        this.type = type;
        this.name = name;
        this.value = value;
    }

    public static Map<Integer, Map<Integer,String>> getEnumsMapFull() {
        Map<Integer,Map<Integer,String>>rMap=new HashMap<Integer,Map<Integer,String>>();
        for (ProServerEnums enumx : ProServerEnums.values()) {
            if(rMap.containsKey(enumx.getType())){
                Map<Integer,String>tMap=rMap.get(enumx.getType());
                tMap.put(enumx.getValue(),enumx.getName());
            }else{
                Map<Integer,String>tMap=new HashMap<Integer,String>();
                tMap.put(enumx.getValue(),enumx.getName());
                rMap.put(enumx.getType(),tMap);
            }
        }
        return rMap;
    }

    public static ProServerEnums getByTypeAndValue(Integer type, Integer value) {
        for (ProServerEnums customSideEnums : ProServerEnums.values()) {
            if (customSideEnums.getType().equals(type) && customSideEnums.getValue().equals(value)) {
                return customSideEnums;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
